// Flexbox Mixins
.flex-center() {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between() {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start() {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-column() {
  display: flex;
  flex-direction: column;
}

// Button Mixins
.button-base() {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: @border-radius;
  font-weight: 500;
  font-size: @font-size-sm;
  line-height: 1.5;
  border: none;
  cursor: pointer;
  transition: all @transition-fast;
  text-decoration: none;

  &:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
}

.button-primary() {
  .button-base();
  background: @primary-600;
  color: white;

  &:hover:not(:disabled) {
    background: @primary-700;
  }

  &:active {
    background: @primary-800;
  }
}

.button-secondary() {
  .button-base();
  background: @gray-100;
  color: @gray-900;

  &:hover:not(:disabled) {
    background: @gray-200;
  }
}

.button-ghost() {
  .button-base();
  background: transparent;
  color: @gray-700;

  &:hover:not(:disabled) {
    background: @gray-100;
  }
}

// Card Mixins
.card-base() {
  background: white;
  border: 1px solid @gray-200;
  border-radius: @border-radius-xl;
  box-shadow: @shadow-sm;
}

.card-hover() {
  .card-base();
  transition: all @transition-fast;

  &:hover {
    box-shadow: @shadow-md;
    transform: translateY(-2px);
  }
}

// Form Mixins
.input-base() {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid @gray-300;
  border-radius: @border-radius;
  font-size: @font-size-base;
  transition: all @transition-fast;

  &::placeholder {
    color: @gray-400;
  }

  &:focus {
    outline: none;
    border-color: @primary-500;
    box-shadow: 0 0 0 3px fade(@primary-500, 10%);
  }

  &:disabled {
    background: @gray-50;
    cursor: not-allowed;
  }
}

// Layout Mixins
.container() {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 @spacing-md;
}

.section-padding() {
  padding: @spacing-2xl @spacing-md;
}

// Animation Mixins
.fade-in(@duration: @transition-normal) {
  animation: fadeIn @duration ease-out;
}

.slide-up(@duration: @transition-normal) {
  animation: slideUp @duration ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

// Scrollbar Mixins
.custom-scrollbar() {
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: @gray-100;
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: @gray-300;
    border-radius: 3px;

    &:hover {
      background: @gray-400;
    }
  }
}

// Text Truncation
.truncate(@lines: 1) {
  overflow: hidden;
  text-overflow: ellipsis;

  & when (@lines = 1) {
    white-space: nowrap;
  }

  & when (@lines > 1) {
    display: -webkit-box;
    -webkit-line-clamp: @lines;
    -webkit-box-orient: vertical;
    white-space: normal;
  }
}
